import time
from page.base_page import Basepage
from appium.webdriver.common.appiumby import AppiumBy as by

class Mypage(Basepage):
    def __init__(self, driver):
        super().__init__(driver)

    def login_process(self):
        self.wait_for_clickable('Mypage', 'login_process')
        return self.find_and_click('Mypage', 'login_process')

    def phone_number(self):
        phone = self.get_test_data('phone_number')  # 从 ini 读取
        self.wait_for_present('Mypage', 'phone_number_input')
        return self.find_and_sendkeys('Mypage', 'phone_number_input', phone)

    def cb_privacy(self):
        self.wait_for_clickable('Mypage', 'cb_privacy')
        return self.find_and_click('Mypage', 'cb_privacy')

    def title_right(self):
        self.wait_for_clickable('Mypage', 'title_right')
        return self.find_and_click('Mypage', 'title_right')

    def et_password(self):
        pwd = self.get_test_data('password')  # 从 ini 读取
        self.wait_for_present('Mypage', 'et_password_input')
        return self.find_and_sendkeys('Mypage', 'et_password_input', pwd)

    def login(self):
        self.wait_for_clickable('Mypage', 'login_button')
        return self.find_and_click('Mypage', 'login_button')


